Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #37994 - Populate bootc fields from facts and associate hosts with manifest entities #11209

Merged
merged 8 commits into from
Nov 15, 2024

Conversation

jeremylenz
Copy link
Member

@jeremylenz jeremylenz commented Nov 7, 2024

What are the changes introduced in this pull request?

  1. Ingest bootc-related facts and populate values in the host's content facet.
  2. Based on the bootc_booted_digest, associate host content facets with either a DockerManifest or DockerManifestList.
  3. Display this information on the new All Hosts UI.

Considerations taken when implementing this change?

  • I didn't use the correct image mode / package mode icons in the table column. This is because it would require Font Awesome icons which we don't have set up.For now I'm using the BundleIcon for package mode, and the MiddlewareIcon for image mode.
  • The table cell has a popover showing the booted image and digest. I didn't link to anything because apparently the appropriate pages don't exist yet.

What are the testing steps for this pull request?

Setup

  1. Run the migrations
  2. Sync a repo containing DockerManifests and DockerManifestLists - https://quay.io/repository/centos-bootc/centos-bootc. Use a tag in include list on docker repo creation page so it doesn't sync everything.. "stream9" tag has a manifest list and some bootable manifests.
  3. Register a host
  4. Create a file on the host, /etc/rhsm/facts/bootc.facts
# cat bootc.facts
{
"bootc.booted.image": "quay.io/centos-bootc/centos-bootc:42",
"bootc.booted.version": "42.20241104.1",
"bootc.booted.digest": "sha256:18ec8a272258b22bf9707b1963d72b8987110c8965c3d08b496fac0b1fb22159",
"bootc.staged.image": "quay.io/fedora/fedora-bootc:40",
"bootc.staged.version": "40.20241023.0",
"bootc.staged.digest": "sha256:b2b888aa0a05f3278e4957cb658fd088e3579e214140dc88ca138f47144d6a05",
"bootc.rollback.image": "quay.io/centos-bootc/centos-bootc:stream9",
"bootc.rollback.version": "stream9.20241101.0",
"bootc.rollback.digest": "sha256:893b636bbc5725378ce602f222f26c29f51334f93243ae8657d31391634eb024",
"bootc.available.image": null,
"bootc.available.version": null,
"bootc.available.digest": null
}
  1. Make sure the bootc.booted.digest matches the digest of one of the DockerManifests or DockerManifestLists you have synced
  2. On the host, run subscription-manager facts --update

Testing

  1. The facts update should complete without errors
  2. The host content facet should show the same data as the facts file:
pry(main)> rhel9b.content_facet
=> #<Katello::Host::ContentFacet:0x00007fac3c807fb0
 id: 4,
 host_id: 5,
 uuid: "45d3d61a-b76e-404d-98ed-3475a06c7611",
 kickstart_repository_id: nil,
 content_source_id: 1,
 installable_security_errata_count: 94,
 installable_enhancement_errata_count: 14,
 installable_bugfix_errata_count: 177,
 applicable_rpm_count: 693,
 upgradable_rpm_count: 693,
 applicable_module_stream_count: 0,
 upgradable_module_stream_count: 0,
 applicable_deb_count: 0,
 upgradable_deb_count: 0,
 bootc_booted_image: "quay.io/centos-bootc/centos-bootc:42",
 bootc_booted_digest: "sha256:18ec8a272258b22bf9707b1963d72b8987110c8965c3d08b496fac0b1fb22159",
 bootc_available_image: nil,
 bootc_available_digest: nil,
 bootc_staged_image: "quay.io/fedora/fedora-bootc:40",
 bootc_staged_digest: "sha256:b2b888aa0a05f3278e4957cb658fd088e3579e214140dc88ca138f47144d6a05",
 bootc_rollback_image: "quay.io/centos-bootc/centos-bootc:stream9",
 bootc_rollback_digest: "sha256:893b636bbc5725378ce602f222f26c29f51334f93243ae8657d31391634eb024",
 manifest_entity_type: "Katello::DockerManifest",
 manifest_entity_id: 8>
  1. Add the new "Image mode / package mode" column to All Hosts and verify it works. Click on an image mode icon to see the popover with details.
  2. These new Active Record queries should work as expected:
my_docker_manifest.hosts
my_docker_manifest.content_facets
my_content_facet.manifest_entity # can be either a DockerManifest or DockerManifestList

# one of the following two will be nil
my_host.docker_manifest
my_host.docker_manifest_list
  1. When you remove the facts from the host and do another facts update:
  • the content facet values should get cleared out
  • the associations will be removed

@jeremylenz jeremylenz changed the title Fixes #37994 - populate bootc fields from facts Fixes #37994 - Populate bootc fields from facts and associate hosts with manifest entities Nov 12, 2024
@jeremylenz jeremylenz marked this pull request as ready for review November 13, 2024 16:51
@jeremylenz jeremylenz force-pushed the 37994-bootc-fields-from-facts branch from 366b67e to 6ef684c Compare November 13, 2024 19:13
<Flex direction={{ default: 'column' }}>
<DescriptionList isHorizontal>
<DescriptionListGroup>
<Dt>{__('Booted image')}</Dt>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to be consistent with Insights which calls it Running image?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, I can do that.

Should I also add the other info we collect? I can also show available, staged, and rollback so it's just like insights.

cc @ianballou

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could also add any of those as options for additional columns you can add. Maybe just "Running image" would make sense. Thoughts?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All these image information will be displayed in the image information card on details tab for each bootc hosts.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check out what Insights has for the pop up:
image

Instead of showing any data, they have a blurb about what a package mode machine is vs an image mode machine.

I prefer seeing the image information over a blurb about what image mode means. We might want to catch up with Maria on it.

Copy link
Member

@ianballou ianballou Nov 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't realize that the hover over text was different from the window that pops up when you click on the icon. I suppose the blurb could go in the hover over part.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't add a blurb in the popover. The one in the screenshot is too downstream-oriented and I'm not sure what it would say for upstream. For now it just has the running image and digest; see what you think..

Copy link
Member

@ianballou ianballou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside from the small comments, this is working really great!

@jeremylenz
Copy link
Member Author

Updated image mode icons and scoped search

Copy link
Member

@ianballou ianballou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, let's ship it.

@ianballou
Copy link
Member

Some tests failed but the errors were unrelated. Re-kicked them.

@jeremylenz jeremylenz merged commit dcf890d into Katello:master Nov 15, 2024
25 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants